﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Global.Class.Library;


namespace DataTransferObject
{
    public class GCGBPlasterMaster : NotifyPropertyChangeObject
    {

        private int gcgbPlasterID;

        private DateTime gcgbPlasterDate;
        private DateTime entryDate;

        private string gcgbPlasterReference;

        private int gcgbCommandID;
        private string gcgbCommandReference;
        private DateTime gcgbCommandDate;

        private int preparedEmployeeID;
        private int approvedEmployeeID;

        private string description;
        private string remarks;

        private bool isDraft;


        public GCGBPlasterMaster()
        {
            GlobalDefaultValue.Apply(this);

            this.GCGBPlasterDate = DateTime.Today;
            this.EntryDate = DateTime.Today;
        }

        public GCGBPlasterMaster ShallowClone()
        {
            return (GCGBPlasterMaster)this.MemberwiseClone();
        }

        #region Properties


        //[DefaultValue(-1)]
        public int GCGBPlasterID
        {
            get { return this.gcgbPlasterID; }
            set { ApplyPropertyChange<GCGBPlasterMaster, int>(ref this.gcgbPlasterID, o => o.GCGBPlasterID, value); }
        }


        [DefaultValue("")]
        public string GCGBPlasterReference
        {
            get { return this.gcgbPlasterReference; }
            set { ApplyPropertyChange<GCGBPlasterMaster, string>(ref this.gcgbPlasterReference, o => o.GCGBPlasterReference, value); }
        }


        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<GCGBPlasterMaster, string>(ref this.description, o => o.Description, value); }
        }


        [DefaultValue("")]
        public string Remarks
        {
            get { return this.remarks; }
            set { ApplyPropertyChange<GCGBPlasterMaster, string>(ref this.remarks, o => o.Remarks, value); }
        }



        [DefaultValue(0)]
        public int GCGBCommandID
        {
            get { return this.gcgbCommandID; }
            set { ApplyPropertyChange<GCGBPlasterMaster, int>(ref this.gcgbCommandID, o => o.GCGBCommandID, value); }
        }

        [DefaultValue("")]
        public string GCGBCommandReference
        {
            get { return this.gcgbCommandReference; }
            set { ApplyPropertyChange<GCGBPlasterMaster, string>(ref this.gcgbCommandReference, o => o.GCGBCommandReference, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime GCGBCommandDate
        {
            get { return this.gcgbCommandDate; }
            set { ApplyPropertyChange<GCGBPlasterMaster, DateTime>(ref this.gcgbCommandDate, o => o.GCGBCommandDate, value); }
        }

        public string GCGBCommandReferenceAndDate
        {
            get { return this.GCGBCommandReference + " [" + this.GCGBCommandDate.ToShortDateString() + "]" ; }
        }


        //[DefaultValue(0)]
        public int PreparedEmployeeID
        {
            get { return this.preparedEmployeeID; }
            set { ApplyPropertyChange<GCGBPlasterMaster, int>(ref this.preparedEmployeeID, o => o.PreparedEmployeeID, value); }
        }


        //[DefaultValue(0)]
        public int ApprovedEmployeeID
        {
            get { return this.approvedEmployeeID; }
            set { ApplyPropertyChange<GCGBPlasterMaster, int>(ref this.approvedEmployeeID, o => o.ApprovedEmployeeID, value); }
        }


        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime GCGBPlasterDate
        {
            get { return this.gcgbPlasterDate; }
            set { ApplyPropertyChange<GCGBPlasterMaster, DateTime>(ref this.gcgbPlasterDate, o => o.GCGBPlasterDate, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<GCGBPlasterMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }


        [DefaultValue(true)]
        public bool IsDraft
        {
            get { return this.isDraft; }
            set { ApplyPropertyChange<GCGBPlasterMaster, bool>(ref this.isDraft, o => o.IsDraft, value); }
        }

        #endregion



        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("GCGBCommandID", "Please select a command.", delegate { return this.GCGBCommandID > 0; }));
            validationRules.Add(new SimpleValidationRule("GCGBCommandReferenceAndDate", "Please select a command.", delegate { return this.GCGBCommandID > 0; }));
            validationRules.Add(new SimpleValidationRule("GCGBPlasterReference", "Reference cannot be blank.", delegate { return this.GCGBPlasterReference.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("PreparedEmployeeID", "Prepared Person cannot be empty.", delegate { return this.PreparedEmployeeID != 0; }));
            validationRules.Add(new SimpleValidationRule("ApprovedEmployeeID", "Approved Person Name cannot be empty.", delegate { return this.ApprovedEmployeeID != 0; }));

            return validationRules;
        }

    }
}

